package moduleTest;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;

@Entity
@Table(schema="poleinfodb", name = "book")
public class Book implements Serializable{
	private static final long serialVersionUID = 2145371722039871095L;

	@EmbeddedId
	private BookPK bookPk;
	
	@Column(length=5000)
	private String summary;
	
	protected Book(){}
	
	public Book(String title,String author){
		this.bookPk = new BookPK(title,author);
	}
	
	public Book(String title,String author,String summary){
		this.bookPk = new BookPK(title,author);
		this.summary = summary;
	}

	public String getSummary() {
		return summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}
	
	public String getTitle(){
		return this.bookPk.getTitle();
	}
	
	public String getAuthor(){
		return this.bookPk.getAuthor();
	}
	
	protected void setBookPK(BookPK pk){
		this.bookPk = pk;
	}
	
	protected BookPK getBookPK(){
		return bookPk;
	}
	
	
	@Override
	public String toString() {
		return "Title="+this.bookPk.getTitle()+" - Author="+this.bookPk.getAuthor();
	}
	
}
